package cn.gemiman.daoyi.module.iot.dal.mysql.userequipment;

import cn.gemiman.daoyi.framework.common.pojo.PageResult;
import cn.gemiman.daoyi.framework.mybatis.core.mapper.BaseMapperX;
import cn.gemiman.daoyi.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gemiman.daoyi.module.iot.controller.admin.userequipment.vo.UserEquipmentPageReqVO;
import cn.gemiman.daoyi.module.iot.dal.dataobject.userequipment.UserEquipmentDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 会员设备 Mapper
 *
 * @author 道一源码
 */
@Mapper
public interface UserEquipmentMapper extends BaseMapperX<UserEquipmentDO> {

    default PageResult<UserEquipmentDO> selectPage(UserEquipmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserEquipmentDO>()
                .eqIfPresent(UserEquipmentDO::getEquipmentManufacturer, reqVO.getEquipmentManufacturer())
                .eqIfPresent(UserEquipmentDO::getEquipmentId, reqVO.getEquipmentId())
                .eqIfPresent(UserEquipmentDO::getPlaceId, reqVO.getPlaceId())
                .eqIfPresent(UserEquipmentDO::getMemberUserId, reqVO.getMemberUserId())
                .betweenIfPresent(UserEquipmentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserEquipmentDO::getId));
    }

}
